home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / appsrcs.zip / APPMORE.ZIP / APPKEYB.C < prev    next >
C/C++ Source or Header  |  1993-04-08  |  2KB  |  90 lines

  1. /* appkeyb.c */
  2.  
  3. /*
  4.    functions for AppMore's keyboard interface
  5. */
  6.  
  7. #define STRICT
  8. #include <windows.h>
  9. #include <windowsx.h>
  10. #include <string.h>
  11. #include "appmore.h"
  12.  
  13. int KeyboardInterface(int key)
  14.     {
  15.     switch(key)
  16.     {
  17.     case VK_ESCAPE:
  18.         if(!bKeyboardOn)
  19.         {
  20.         bKeyboardOn = TRUE;    // turn keyb interface on
  21.         iKey = iCurrent = 0;
  22.         InvalidateRect(hWndButton[iCurrent], (LPRECT) NULL, FALSE);
  23.         UpdateWindow(hWndButton[iCurrent]);
  24.         }
  25.         else
  26.         {
  27.         bKeyboardOn = FALSE;    // turn keyb interface off
  28.         InvalidateRect(hWndButton[iCurrent], (LPRECT) NULL, FALSE);
  29.         UpdateWindow(hWndButton[iCurrent]);
  30.         }
  31.         return 0;
  32.  
  33.     case VK_DELETE:
  34.         if(bKeyboardOn)
  35.         SendMessage(hWndMain, WM_COMMAND, ID_BUTTON1+iCurrent, MAKELPARAM(0, BN_DOUBLECLICKED));
  36.         return 0;
  37.  
  38.     case VK_RETURN:
  39.         if(bKeyboardOn)
  40.         SendMessage(hWndMain, WM_COMMAND, ID_BUTTON1+iCurrent, MAKELPARAM(0, BN_CLICKED));
  41.         return 0;
  42.  
  43.     case VK_UP:
  44.         if(bKeyboardOn)
  45.         {
  46.         bKeyboardOn = FALSE;
  47.         InvalidateRect(hWndButton[iCurrent], (LPRECT) NULL, FALSE);
  48.         UpdateWindow(hWndButton[iCurrent]);
  49.         iCurrent = max(0, iCurrent-1);
  50.         iKey = iCurrent;
  51.         bKeyboardOn = TRUE;
  52.         InvalidateRect(hWndButton[iCurrent], (LPRECT) NULL, FALSE);
  53.         UpdateWindow(hWndButton[iCurrent]);
  54.         }
  55.         return 0;
  56.  
  57.     case VK_DOWN:
  58.         if(bKeyboardOn)
  59.         {
  60.         bKeyboardOn = FALSE;
  61.         InvalidateRect(hWndButton[iCurrent], (LPRECT) NULL, FALSE);
  62.         UpdateWindow(hWndButton[iCurrent]);
  63.         iCurrent++;
  64.         iCurrent = min(AppWindow.nButtons-1, iCurrent);
  65.         iKey = iCurrent;
  66.         bKeyboardOn = TRUE;
  67.         InvalidateRect(hWndButton[iCurrent], (LPRECT) NULL, FALSE);
  68.         UpdateWindow(hWndButton[iCurrent]);
  69.         }
  70.         return 0;
  71.  
  72.     default:
  73.         return 0;
  74.     }
  75.     }
  76.  
  77. /*-------------------------------------------------------------------------*/
  78. int ProcessSystemKeys(int SysKey)
  79.     {
  80.     switch(SysKey)
  81.     {
  82.     case VK_F4:
  83.          SendMessage(hWndMain, WM_DESTROY, 0, 0);
  84.          return 0;
  85.  
  86.     default:
  87.          return 0;
  88.     }
  89.     }
  90.